package com.zmn.plat.common.dictionary;

/**
 * 消息类型枚举
 *
 * @author linfeng
 * @since 2020/05/18 14:56:30
 */
public enum MsgTypeEnum {

    /**
     * values
     */
    NOTICE(1, "通知"),
    UPCOMING(2, "待办"),
    CHECK(3, "审核"),
    REMIND(4, "提醒")
    ;

    private Integer code;
    private String name;

    MsgTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static MsgTypeEnum of(Integer code) {
        if (code == null || code == 0) {
            return NOTICE;
        }
        switch (code) {
            case 1:
                return NOTICE;
            case 2:
                return UPCOMING;
            case 3:
                return CHECK;
            case 4:
                return REMIND;
            default:
                return NOTICE;
        }
    }
}
